package gtkwire.widget;

import gtkwire.*;
import gtkwire.listener.ValueChangeListener;
import gtkwire.listener.connector.ValueChangeListenerFilter;
import gtkwire.widget.utils.GtkPositionType;
import gtkwire.gobject.*;

/**
*Base class for GtkHScale and GtkVScale.
*/
public abstract class GtkScale extends GtkRange
{

	protected GtkScale( GtkAdjustment adjustment )
	{
		super( adjustment );
	}

	protected GtkScale( String name, GladeKey key )
	{
		super( name, key );
	}

	/**
	*Sets the position in which the current value is displayed.
	*/
	public void setValuePosition( GtkPositionType pos )
	{
		app().sendCommand( name, GTKWireCommand.SET_POSITION, pos.getType() );
	}

	/**
	*Specifies whether the current value is displayed as a string next to the slider.
	*/
	public void setDrawValue( boolean b )
	{
		app().sendCommand( name, GTKWireCommand.SET_DRAW, b );
	}

	/**
	*Sets the number of decimal places that are displayed in the value. 
	*Also causes the value of the adjustment to be rounded off to this number of digits, so the retrieved value matches the value the user saw.
	*/
	public void setDigits( int digits )
	{
		app().sendCommand( name, GTKWireCommand.SET_DIGITS, digits );
	}

	/**
	*Adds listner that is notified as set using setUpdatePolicy() value.
	*/
	public void addValueChangeListener( ValueChangeListener listener )
	{
		ValueChangeListenerFilter vl = new ValueChangeListenerFilter( listener );
		vl.addFilteringName( name );
		app().addListener( vl );
	}

}//end class